home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / load.tab.p < prev    next >
Text File  |  2003-09-23  |  11KB  |  297 lines

  1. {
  2.   X = -230;
  3.   Y = 60;
  4.   state = 0;
  5.   rest_x = -230;
  6.   expand_x = -10;
  7.   Hidden = 1;
  8.  
  9.   ScriptID = script {
  10.     @loaded {
  11.       resid plateID;
  12.       resid tabID;
  13.       int   plate_width;
  14.       
  15.       plateID = GuiChildByName(SELF, "plate");
  16.       tabID   = GuiChildByName(SELF, "tab");
  17.  
  18.       plate_width = ResPropGetInt(plateID, "Width");
  19.       ResPropSetInt(SELF, "rest_x", - plate_width);
  20.       
  21.       ResPropSetInt(tabID, "X", plate_width - 4);
  22.     }
  23.   };
  24.   
  25.   ChildID = {
  26.  
  27.     GuiAnimation("plate") {
  28.       AnimationID = "gui/dash/tab/plate/plate.pcx";
  29.       X = 0;
  30.       Width = 235;
  31.       Height = 180;
  32.     },
  33.  
  34.     GuiLayer("can_load_layer") {
  35.       X = 25;    
  36.       Y = 10;
  37.       Hidden = TRUE;
  38.       ChildID = {
  39.             GuiLoadMessage("can_load_message_label") {
  40.           X = 0;
  41.           Y = 10;
  42.           Width = 185;
  43.           Height = 40;
  44.           WordWrap = TRUE;
  45.           InputDisabled = TRUE;
  46.           FontID = "font/tab_w_on_g.tf";
  47.         },      
  48.  
  49.         GuiLoadMessage("can_load_message") {
  50.           X = 0;
  51.           Y = 30;
  52.     
  53.           Width = 185;
  54.           Height = 150;
  55.           WordWrap = TRUE;
  56.           InputDisabled = TRUE;
  57.           FontID = "font/verdana_9.tf";
  58.           ScriptID = Script {
  59.             @show {
  60.               ResPropSetInt(GuiSiblingByName("wait"),"Hidden",TRUE);
  61.               ResPropSetInt(GuiSiblingByName("load"),"Hidden",TRUE);
  62.             }
  63.             @animate {
  64.               ResParseEvent(ResByName("common/country_specific.c4"),"@load_tab_can_load_message");
  65.             }
  66.           };
  67.         },
  68.         GuiButton("load") {
  69.           X = 55;
  70.           Y = 100;
  71.           Hidden = 1;
  72.           TextID = Mangle(120/*"Load"*/);
  73.           StyleID = "gui/dash/tab/button/tab.gbs";
  74.           FontID = "font/tab_button.tf";
  75.           Width = 60;
  76.           AutoSize = Height;
  77.           ScriptID = Script {
  78.             @activate { 
  79.               resid Player;    
  80.               resid CommodityToLoad;
  81.               resid PlayerPhoto;
  82.               resid CommodityData;
  83.               resid Message;
  84.               
  85.               str commodity;
  86.               str animation;
  87.               int commodity_row;
  88.               
  89.  
  90.  
  91.               Message         = ResByName("dash.gl/message");
  92.               CommodityData   = ResPropGetResID(ResByName("CSVData"), "commodity_id");
  93.               Player          = ResPropGetResID(ResByName("Game"),"game_cur_player");
  94.               CommodityToLoad = ResPropGetResID(Player,"nav_commodity_to_load");              
  95.               commodity       = ResPropGetStr(CommodityToLoad,"commodity_name");
  96.               commodity_row   = CSVSearch(CommodityData,"name",commodity);
  97.               animation       = CSVGetStr(CommodityData,"animation",commodity_row);
  98.  
  99.  
  100.  
  101.               ResPropSetInt(CommodityToLoad,"commodity_state",1);
  102.               ResPropSetInt(SELF,"Hidden",TRUE);              
  103.               
  104.               /* get the postcard for this commodity */
  105.               PlayerPhoto = ResPropGetResID(Player, "photo_commodity");              
  106.               if( StrListAppend(PlayerPhoto,commodity) ) {
  107.                 ResPropSetStr(Player, "photo_current", commodity);
  108.                 ResPropSetResID(Player, "photo_current_type", PlayerPhoto);
  109.                 ResPropSetResID(ResByName("postcard.tab/tab"),"AnimationID",ResByName("gui/dash/tab/postcard/postcard_on.pcx"));
  110.               }
  111.  
  112.               /* turn off the tab light */
  113.               ResPropSetResID(ResByName("load.tab/tab"),"AnimationID",ResByName("gui/dash/tab/load/load_off.pcx"));
  114.               
  115.               /* collapse the tab, since we are loading */
  116.               ResPropSetResID(Player,"truck_tab_expanded",RES_INVALID);     
  117.  
  118.               /* tell the user that the commodity has loaded */
  119.               ResPropSetStr(Message, "InputText", StrFormatStr(MangleSIDToStr(121/*"Good work! You have just loaded %s."*/),commodity));
  120.               ResPropSetInt(Message, "timeout", CVarGetInt("framerate") * 10);
  121.               ResParseEvent(ResByName("dash.gl/message"),"@animate");
  122.  
  123.               /* load full screen animation */
  124.               ResPropSetStr(Player, "nav_picture", animation);
  125.               ResPropSetInt(Player, "nav_switch_player", 1);
  126.               ResPropSetStr(Player, "nav_sound",   "forklift");
  127.               ResPropSetInt(Player, "nav_picture_no_dash_flag", 1);
  128.               ResPropSetInt(ResByName("dash.gl/full_screen"), "Hidden", FALSE);
  129.  
  130.  
  131.             }
  132.           }
  133.         },
  134.         GuiButton("wait") {       
  135.           X = 55;
  136.           Y = 100;
  137.           Hidden = 1;          
  138.           TextID = Mangle(122/*"Wait"*/);
  139.           StyleID = "gui/dash/tab/button/tab.gbs";
  140.           FontID = "font/tab_button.tf";
  141.           Width = 60;
  142.           AutoSize = Height;
  143.           ScriptID = Script {
  144.             @activate { 
  145.               resid Player;
  146.               resid Game;
  147.               int hour_now;
  148.               int minute_now;
  149.               int time_difference;
  150.               int time_zone_real_offset;
  151.               int game_business_close_hour;
  152.               int game_business_open_hour;
  153.               int time_now;
  154.               Game = ResByName("Game");
  155.               Player = ResPropGetResID(Game,"game_cur_player");  
  156.               ResPropAlias(Player,"time_now","time_now");
  157.               ResPropAlias(Player,"time_zone_real_offset","time_zone_real_offset");         
  158.               
  159.               game_business_close_hour = ResPropGetInt(Game,"game_business_close_hour");
  160.               game_business_open_hour  = ResPropGetInt(Game,"game_business_open_hour");
  161.               
  162.               time_now += (time_zone_real_offset * 60);
  163.               hour_now    = TimeGetHour(time_now);
  164.               minute_now  = TimeGetMinute(time_now);
  165.               
  166.  
  167.               if (hour_now < game_business_open_hour) {
  168.                 time_difference = ((game_business_open_hour - 1) - hour_now) * 3600;
  169.                 time_difference += (60 - minute_now) * 60;
  170.               }
  171.               
  172.               if (hour_now >= game_business_close_hour) {
  173.                 time_difference = (((game_business_close_hour + 1) - hour_now) * 3600) + 28800;
  174.                 time_difference += (60 - minute_now) * 60;            
  175.               }
  176.               
  177.               time_now += time_difference;
  178.               
  179.               ResPropSetInt(Player,"player_hunger", (ResPropGetInt(Player,"player_hunger")+ time_difference) );
  180.               ResPropSetInt(Player,"player_fatigue", (ResPropGetInt(Player,"player_fatigue")+ time_difference) );
  181.               
  182.               
  183.               time_now -= (time_zone_real_offset * 60);
  184.  
  185.               ResParseEvent(ResByName("common/set_business_open.c4"),"@set_business_open");
  186.                          
  187.               ResPropSetInt(SELF,"Hidden",TRUE);
  188.             }
  189.           }
  190.         }
  191.         
  192.       };
  193.     },  
  194.  
  195.     GuiLayer("cannot_load_layer") {
  196.       X = 25;    
  197.       Y = 0;
  198.       Hidden = TRUE;
  199.       ChildID = {
  200.         /* these should be GuiAnimation's with AnimationID = -1 and a TextID */
  201.             GuiTextInput("cannot_load_message_label") {
  202.           X = 0;
  203.           Y = 30;
  204.           Width = 185;
  205.           Height = 100;
  206.           WordWrap = TRUE;
  207.           InputDisabled = TRUE;
  208.           FontID = "font/tab_w_on_g.tf";
  209.           ScriptID = Script {
  210.             @show {
  211.               ResPropSetStr(SELF,"InputText",MangleSIDToStr(123/*"You are not in a city."*/));
  212.             }
  213.           };
  214.         },
  215.             GuiTextInput("cannot_load_message") {
  216.           X = 0;
  217.           Y = 50;
  218.           Width = 185;
  219.           Height = 120;
  220.           WordWrap = TRUE;
  221.           InputDisabled = TRUE;
  222.           FontID = "font/verdana_9.tf";
  223.           ScriptID = Script {
  224.             @show {
  225.               ResPropSetStr(SELF,"InputText",MangleSIDToStr(124/*"In order to load a commodity, you must first drive to a city in which it is available.\n\nLook at the Dispatch tab in the Laptop to view the commodities you need to pick up."*/));
  226.             }
  227.           };
  228.         }   
  229.       };
  230.     },  
  231.   
  232.     GuiAnimation("tab") {
  233.       X = 240;
  234.       Y = 82;
  235.       AnimationID = "gui/dash/tab/load/load_off.pcx";
  236.       ScriptID = script {
  237.         @activate {
  238.           resid Parent;
  239.           resid Player;
  240.           resid Game;
  241.          
  242.           Game = ResByName("Game");
  243.           Player = ResPropGetResID(ResByName("Game"),"game_cur_player");          
  244.           Parent = GuiParent(SELF);
  245.  
  246.           ResParseEvent(ResByName("common/set_business_open.c4"),"@set_business_open");
  247.  
  248.           if ( ResPropGetResID(Player,"truck_tab_expanded") == Parent) {
  249.             ResPropSetResID(Player,"truck_tab_expanded",RES_INVALID);            
  250.           } else {
  251.             ResPropSetResID(Player,"truck_tab_expanded",Parent);
  252.           }
  253.         }
  254.         @animate {
  255.           resid Parent;
  256.           int state;
  257.           int at_city;           
  258.           resid Player;
  259.           resid Game;
  260.        
  261.           Game = ResByName("Game");
  262.           Player = ResPropGetResID(ResByName("Game"),"game_cur_player");          
  263.           Parent = GuiParent(SELF);
  264.           at_city = ResPropGetInt(Player,"nav_at_city");
  265.  
  266.           if (at_city == 0) {            
  267.             ResPropSetResID(ResByName("load.tab/tab"),"AnimationID",ResByName("gui/dash/tab/load/load_off.pcx"));
  268.           }
  269.                         
  270.           if ( ResPropGetResID(Player,"truck_tab_expanded") == Parent) {
  271.             ResPropSetInt(Parent,"X",ResPropGetInt(Parent,"expand_x"));
  272.             GuiToFront(Parent);
  273.             ResPropSetInt(GuiSiblingByName("plate"),"Hidden",FALSE);
  274.  
  275.             if (at_city == 1) {
  276.               ResPropSetInt(GuiSiblingByName("can_load_layer"),"Hidden",FALSE);
  277.               ResPropSetInt(GuiSiblingByName("cannot_load_layer"),"Hidden",TRUE);
  278.             } else {           
  279.               ResPropSetInt(GuiSiblingByName("cannot_load_layer"),"Hidden",FALSE);   
  280.               ResPropSetInt(GuiSiblingByName("can_load_layer"),"Hidden",TRUE);                     
  281.             }
  282.           } else {
  283.             ResPropSetInt(GuiSiblingByName("plate"),"Hidden",TRUE);
  284.             ResPropSetInt(Parent,"X",ResPropGetInt(Parent,"rest_x"));
  285.             ResPropSetInt(GuiSiblingByName("cannot_load_layer"),"Hidden",TRUE);   
  286.             ResPropSetInt(GuiSiblingByName("can_load_layer"),"Hidden",TRUE);               
  287.           }
  288.           
  289.  
  290.        
  291.           
  292.         }
  293.       }
  294.       }    
  295.   };
  296. }
  297.